<div class="site-content">
  <div class="site-content-cap">
    <h2 class="site-content-heading"><%= t('views.organizations.select_organization') %></h2>
  </div>

  <div class="site-content-body">
    <% if @users_github_organizations.empty? %>
      <div class="blankslate large-format spacious clean-background">
        <h3><%= t('views.organizations.no_organizations') %></h3>

        <p><%= t('views.organizations.please_create_or_authorize_new_organization', authorize_href: link_to(t('views.organizations.authorize_organization_access_link'), "https://github.com/settings/connections/applications/#{Rails.application.secrets.github_client_id}", target: '_blank')).html_safe %></p>
      </div>
    <% else %>
      <%= form_for @organization do |f| %>
        <%= render 'shared/error_messages', object: f.object %>

        <div class="org-select-grid">
          <% @users_github_organizations.each do |org| %>
            <% if org[:role] == 'admin' && !org[:classroom].present? %>
              <%= render partial: 'organization_select', locals: { org: org } %>
            <% else %>
              <%= render partial: 'disabled_organization_select', locals: { org: org } %>
            <% end %>
          <% end %>
          <a href="<%= "https://github.com/settings/connections/applications/#{Rails.application.secrets.github_client_id}" %>" target="_blank" class="organization-select-target organization-grant-access-avatar">
            <span class="organization-grant-access-text"><%= t('views.organizations.grant_organization_access').html_safe %></span>
          </a>
          <div style="clear:both"></div>
        </div>
      <% end %>
    <% end %>

    <%= render partial: 'shared/pagination', locals: { collection: @users_github_organizations } %>
  </div>
</div>

<div class="protip">
  <%= octicon 'light-bulb' %> <%= t('views.organizations.grant_organization_access_protip', href: link_to(t('views.organizations.grant_organization_access_link'), "https://github.com/settings/connections/applications/#{Rails.application.secrets.github_client_id}", target: '_blank')).html_safe %>
</div>
